Commit b2eb1a20 authored by Siarhei Siamashka's avatar Siarhei Siamashka
Browse files

DRI2 integration for Mali400 binary blobs support and OpenGL ES acceleration

The driver can use sunxi display controller layers for fully visible
windows, avoiding expensive memory copy.
parent 64d51c0f
......@@ -81,6 +81,14 @@ fi
# Checks for libraries.
AC_CHECK_LIB([UMP], [ump_open],
[have_libump=yes
LIBS="$LIBS -lUMP"
AC_DEFINE(HAVE_LIBUMP,[1],[libUMP library])],
[have_libump=no])
AC_CHECK_LIB([UMP], [ump_cache_operations_control],
[AC_DEFINE(HAVE_LIBUMP_CACHE_CONTROL,[1],[UMP cache control])])
AM_CONDITIONAL([HAVE_LIBUMP], [test x$have_libump = xyes])
AC_SUBST([moduledir])
......
......@@ -65,6 +65,28 @@ Enable rotation of the display. The supported values are "CW" (clockwise,
.TP
.BI "Option \*qHWCursor\*q \*q" boolean \*q
Enable or disable the HW cursor. Default: on.
.TP
.BI "Option \*qDRI2\*q \*q" boolean \*q
Enable or disable DRI2 integration for Mali GPU. Provides hardware
accelerated OpenGL ES in the case if proprietary blob libMali.so
is installed in the system and linux kernel provides modules mali.ko,
mali_drm.ko and ump.ko with compatible version (for example, both kernel
modules and libMali.so can have revision r3p0). Default: on.
.TP
.BI "Option \*qDRI2HWOverlay\*q \*q" boolean \*q
Enable the use of display controller hardware overlays (aka "layers",
"windows", ...) for fully visible DRI2 backed OpenGL ES windows in order
to avoid expensive memory copy operations. That's a zero-copy solution
which eliminates unnecessary CPU overhead. Default: on.
.B Note:
the hardware overlays are automatically disabled in the case if a
compositing window manager (xfwm4, kwin, ...) is used for various
fancy desktop effects such as windows translucency or shadows. Maybe
some improments are possible in this area. But if you really care
about the desktop performance, you don't want to enable any
compositing effects in your window manager anyway.
.SH "SEE ALSO"
__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__),
X(__miscmansuffix__), fbdevhw(__drivermansuffix__)
......
......@@ -36,3 +36,9 @@ sunxifb_drv_la_SOURCES = \
sunxi_disp.h \
sunxi_disp_hwcursor.c \
sunxi_disp_hwcursor.h
if HAVE_LIBUMP
sunxifb_drv_la_SOURCES += \
sunxi_mali_ump_dri2.c \
sunxi_mali_ump_dri2.h
endif
......@@ -47,6 +47,11 @@
#include "dgaproc.h"
#include "sunxi_disp.h"
#include "sunxi_disp_hwcursor.h"
#ifdef HAVE_LIBUMP
#include "sunxi_mali_ump_dri2.h"
#endif
/* for visuals */
#include "fb.h"
......@@ -154,7 +159,9 @@ typedef enum {
OPTION_FBDEV,
OPTION_DEBUG,
OPTION_HW_CURSOR,
OPTION_SW_CURSOR
OPTION_SW_CURSOR,
OPTION_DRI2,
OPTION_DRI2_OVERLAY,
} FBDevOpts;
static const OptionInfoRec FBDevOptions[] = {
......@@ -164,6 +171,8 @@ static const OptionInfoRec FBDevOptions[] = {
{ OPTION_DEBUG, "debug", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_HW_CURSOR, "HWCursor", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_SW_CURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_DRI2, "DRI2", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_DRI2_OVERLAY, "DRI2HWOverlay",OPTV_BOOLEAN, {0}, FALSE },
{ -1, NULL, OPTV_NONE, {0}, FALSE }
};
......@@ -941,6 +950,25 @@ FBDevScreenInit(SCREEN_INIT_ARGS_DECL)
"failed to enable hardware cursor\n");
}
#ifdef HAVE_LIBUMP
if (xf86ReturnOptValBool(fPtr->Options, OPTION_DRI2, TRUE)) {
fPtr->SunxiMaliDRI2_private = SunxiMaliDRI2_Init(pScreen,
xf86ReturnOptValBool(fPtr->Options, OPTION_DRI2_OVERLAY, TRUE));
if (fPtr->SunxiMaliDRI2_private)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"using DRI2 integration for Mali GPU (UMP buffers)\n");
else
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"failed to enable DRI2 integration for Mali GPU\n");
}
else {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"DRI2 integration for Mali GPU is disabled in xorg.conf\n");
}
#endif
TRACE_EXIT("FBDevScreenInit");
return TRUE;
......@@ -952,6 +980,14 @@ FBDevCloseScreen(CLOSE_SCREEN_ARGS_DECL)
ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
FBDevPtr fPtr = FBDEVPTR(pScrn);
#ifdef HAVE_LIBUMP
if (fPtr->SunxiMaliDRI2_private) {
SunxiMaliDRI2_Close(pScreen);
free(fPtr->SunxiMaliDRI2_private);
fPtr->SunxiMaliDRI2_private = NULL;
}
#endif
if (fPtr->SunxiDispHardwareCursor_private) {
SunxiDispHardwareCursor_Close(pScreen);
free(fPtr->SunxiDispHardwareCursor_private);
......
......@@ -50,6 +50,7 @@ typedef struct {
void *sunxi_disp_private;;
void *SunxiDispHardwareCursor_private;
void *SunxiMaliDRI2_private;
} FBDevRec, *FBDevPtr;
#define FBDEVPTR(p) ((FBDevPtr)((p)->driverPrivate))
......@@ -59,3 +60,6 @@ typedef struct {
#define SUNXI_DISP_HWC(p) ((SunxiDispHardwareCursor *) \
(FBDEVPTR(p)->SunxiDispHardwareCursor_private))
#define SUNXI_MALI_UMP_DRI2(p) ((SunxiMaliDRI2 *) \
(FBDEVPTR(p)->SunxiMaliDRI2_private))
This diff is collapsed.
/*
* Copyright © 2013 Siarhei Siamashka <siarhei.siamashka@gmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef SUNXI_MALI_UMP_DRI2_H
#define SUNXI_MALI_UMP_DRI2_H
#include <ump/ump.h>
#include <ump/ump_ref_drv.h>
typedef struct {
int overlay_x;
int overlay_y;
WindowPtr pOverlayWin;
void *pOverlayDirtyDRI2Buf;
Bool bOverlayWinEnabled;
Bool bOverlayWinOverlapped;
Bool bWalkingAboveOverlayWin;
DestroyWindowProcPtr DestroyWindow;
PostValidateTreeProcPtr PostValidateTree;
GetImageProcPtr GetImage;
ump_secure_id ump_fb_secure_id;
int drm_fd;
} SunxiMaliDRI2;
SunxiMaliDRI2 *SunxiMaliDRI2_Init(ScreenPtr pScreen, Bool bUseOverlay);
void SunxiMaliDRI2_Close(ScreenPtr pScreen);
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment