Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to specify dri device path #34

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions man/fbturbo.man
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ some improvements are possible in this area. But if you really care
about the desktop performance, then you likely don't want to enable
any compositing effects in your window manager anyway.
.TP
.BI "Option \*qDRIDevicePath\*q \*q" string \*q
Specify path to DRI device. By default, fbturbo uses drmOpen
to open correct device, but it may not work on sunxi devices when
using second screen (on /dev/fb1) and uses /dev/dri/card0 instead of
/dev/dri/card1. Then you can specify the correct path. Default: (null)
.TP
.BI "Option \*qSwapbuffersWait\*q \*q" boolean \*q
This option controls the behavior of eglSwapBuffers calls by OpenGL ES
applications. If enabled, the calls will try to avoid tearing by making
Expand Down
5 changes: 4 additions & 1 deletion src/fbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ typedef enum {
OPTION_USE_BS,
OPTION_FORCE_BS,
OPTION_XV_OVERLAY,
OPTION_DRI_PATH,
} FBDevOpts;

static const OptionInfoRec FBDevOptions[] = {
Expand All @@ -189,6 +190,7 @@ static const OptionInfoRec FBDevOptions[] = {
{ OPTION_USE_BS, "UseBackingStore",OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_FORCE_BS, "ForceBackingStore",OPTV_BOOLEAN,{0}, FALSE },
{ OPTION_XV_OVERLAY, "XVHWOverlay", OPTV_BOOLEAN, {0}, FALSE },
{ OPTION_DRI_PATH, "DRIDevicePath",OPTV_STRING, {0}, FALSE },
{ -1, NULL, OPTV_NONE, {0}, FALSE }
};

Expand Down Expand Up @@ -1075,7 +1077,8 @@ FBDevScreenInit(SCREEN_INIT_ARGS_DECL)

fPtr->SunxiMaliDRI2_private = SunxiMaliDRI2_Init(pScreen,
xf86ReturnOptValBool(fPtr->Options, OPTION_DRI2_OVERLAY, TRUE),
xf86ReturnOptValBool(fPtr->Options, OPTION_SWAPBUFFERS_WAIT, TRUE));
xf86ReturnOptValBool(fPtr->Options, OPTION_SWAPBUFFERS_WAIT, TRUE),
xf86GetOptValString(fPtr->Options, OPTION_DRI_PATH));

if (fPtr->SunxiMaliDRI2_private) {
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
Expand Down
21 changes: 16 additions & 5 deletions src/sunxi_mali_ump_dri2.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <ump/ump_ref_drv.h>

#include <sys/ioctl.h>
#include <fcntl.h>

#include "xorgVersion.h"
#include "xf86_OSproc.h"
Expand Down Expand Up @@ -1076,7 +1077,8 @@ static unsigned long ump_get_size_from_secure_id(ump_secure_id secure_id)

SunxiMaliDRI2 *SunxiMaliDRI2_Init(ScreenPtr pScreen,
Bool bUseOverlay,
Bool bSwapbuffersWait)
Bool bSwapbuffersWait,
char *driPath)
{
int drm_fd;
DRI2InfoRec info;
Expand All @@ -1091,10 +1093,19 @@ SunxiMaliDRI2 *SunxiMaliDRI2_Init(ScreenPtr pScreen,

if (!xf86LoadSubModule(xf86Screens[pScreen->myNum], "dri2"))
return NULL;

if ((drm_fd = drmOpen("mali_drm", NULL)) < 0) {
ErrorF("SunxiMaliDRI2_Init: drmOpen failed!\n");
return NULL;
if(driPath)
{
if ((drm_fd = open(driPath, O_RDWR, 0)) < 0) {
ErrorF("SunxiMaliDRI2_Init: drmOpen failed!\n");
return NULL;
}
}
else
{
if ((drm_fd = drmOpen("mali_drm", NULL)) < 0) {
ErrorF("SunxiMaliDRI2_Init: drmOpen failed!\n");
return NULL;
}
}

if (ump_open() != UMP_OK) {
Expand Down
3 changes: 2 additions & 1 deletion src/sunxi_mali_ump_dri2.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ typedef struct {

SunxiMaliDRI2 *SunxiMaliDRI2_Init(ScreenPtr pScreen,
Bool bUseOverlay,
Bool bSwapbuffersWait);
Bool bSwapbuffersWait,
char *driPath);
void SunxiMaliDRI2_Close(ScreenPtr pScreen);

#endif