Skip to content

Commit

Permalink
Support for Raspberry Pi hardware cursor
Browse files Browse the repository at this point in the history
Requires firmware changes but will detect at
run time if the firmware supports the HW cursor
and enabled/disable as necessary.

The required firmware has been in the wild for some
time so most will already have it.
  • Loading branch information
jamesh authored and JamesH65 committed Jul 8, 2014
1 parent 8dec039 commit 5d4c660
Show file tree
Hide file tree
Showing 7 changed files with 923 additions and 8 deletions.
6 changes: 5 additions & 1 deletion src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ fbturbo_drv_la_SOURCES = \
sunxi_video.c \
sunxi_video.h \
sunxi_disp_ioctl.h \
g2d_driver.h
g2d_driver.h \
raspi_hwcursor.c \
raspi_hwcursor.h \
raspi_mailbox.c \
raspi_mailbox.h

if HAVE_LIBUMP
fbturbo_drv_la_SOURCES += \
Expand Down
26 changes: 19 additions & 7 deletions src/fbdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@
#include "backing_store_tuner.h"
#include "sunxi_video.h"

#include "raspi_hwcursor.h"

#ifdef HAVE_LIBUMP
#include "sunxi_mali_ump_dri2.h"
#endif
Expand Down Expand Up @@ -282,12 +284,12 @@ static Bool FBDevPciProbe(DriverPtr drv, int entity_num,
pScrn = xf86ConfigPciEntity(NULL, 0, entity_num, NULL, NULL,
NULL, NULL, NULL, NULL);
if (pScrn) {
char *device;
const char *device;
GDevPtr devSection = xf86GetDevFromEntity(pScrn->entityList[0],
pScrn->entityInstanceList[0]);

device = xf86FindOptionValue(devSection->options, "fbdev");
if (fbdevHWProbe(NULL, device, NULL)) {
if (fbdevHWProbe(NULL, (char*)device, NULL)) {
pScrn->driverVersion = FBDEV_VERSION;
pScrn->driverName = FBDEV_DRIVER_NAME;
pScrn->name = FBDEV_NAME;
Expand Down Expand Up @@ -326,7 +328,7 @@ FBDevProbe(DriverPtr drv, int flags)
#ifndef XSERVER_LIBPCIACCESS
int bus,device,func;
#endif
char *dev;
const char *dev;
Bool foundScreen = FALSE;

TRACE("probe start");
Expand Down Expand Up @@ -363,7 +365,7 @@ FBDevProbe(DriverPtr drv, int flags)
0;

}
if (fbdevHWProbe(NULL,dev,NULL)) {
if (fbdevHWProbe(NULL,(char*)dev,NULL)) {
pScrn = NULL;
if (isPci) {
#ifndef XSERVER_LIBPCIACCESS
Expand Down Expand Up @@ -464,7 +466,7 @@ FBDevPreInit(ScrnInfoPtr pScrn, int flags)
}
#endif
/* open device */
if (!fbdevHWInit(pScrn,NULL,xf86FindOptionValue(fPtr->pEnt->device->options,"fbdev")))
if (!fbdevHWInit(pScrn, NULL, (char*)xf86FindOptionValue(fPtr->pEnt->device->options,"fbdev")))
return FALSE;
default_depth = fbdevHWGetDepth(pScrn,&fbbpp);
if (!xf86SetDepthBpp(pScrn, default_depth, default_depth, fbbpp,
Expand Down Expand Up @@ -1066,8 +1068,18 @@ FBDevScreenInit(SCREEN_INIT_ARGS_DECL)
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"using hardware cursor\n");
else
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
"failed to enable hardware cursor\n");
{
// Try the raspi cursor code

xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Detecting Raspi HW cursor...\n");

fPtr->SunxiDispHardwareCursor_private = raspberry_cursor_init(pScreen);

if (fPtr->SunxiDispHardwareCursor_private)
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "using Raspi hardware cursor\n");
else
xf86DrvMsg(pScrn->scrnIndex, X_INFO, "failed to enable hardware cursor\n");
}
}

#ifdef HAVE_LIBUMP
Expand Down
2 changes: 2 additions & 0 deletions src/fbdev_priv.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,5 @@ typedef struct {

#define SUNXI_VIDEO(p) ((SunxiVideo *) \
(FBDEVPTR(p)->SunxiVideo_private))

#define RASPI_DISP_HWC(p) ((raspberry_cursor_state_s *) (FBDEVPTR(p)->SunxiDispHardwareCursor_private))
Loading

0 comments on commit 5d4c660

Please sign in to comment.