Bool
PnozzHWCursorInit(ScreenPtr pScreen)
{
    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    PnozzPtr pPnozz;
    xf86CursorInfoPtr infoPtr;

    pPnozz = GET_PNOZZ_FROM_SCRN(pScrn);

    infoPtr = xf86CreateCursorInfoRec();
    if(!infoPtr) return FALSE;

    pPnozz->CursorInfoRec = infoPtr;

    infoPtr->MaxWidth = 64;
    infoPtr->MaxHeight = 64;

    xf86SbusSetOsHwCursorHotSpot(pPnozz->psdp, 63, 63);

    infoPtr->Flags = HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
	HARDWARE_CURSOR_TRUECOLOR_AT_8BPP /* |
	HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
	HARDWARE_CURSOR_NIBBLE_SWAPPED */ ;

    infoPtr->SetCursorColors = PnozzSetCursorColors;
    infoPtr->SetCursorPosition = PnozzSetCursorPosition;
    infoPtr->LoadCursorImage = PnozzLoadCursorImage;
    infoPtr->HideCursor = PnozzHideCursor;
    infoPtr->ShowCursor = PnozzShowCursor;
    infoPtr->UseHWCursor = NULL;

    return xf86InitCursor(pScreen, infoPtr);
}
Example #2
0
Bool S3Ti_CursorInit(ScreenPtr pScreen)
{
        ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
        S3Ptr pS3 = S3PTR(pScrn);
        xf86CursorInfoPtr pCurs;      
        
        if (!(pCurs = pS3->pCurs = xf86CreateCursorInfoRec()))
                return FALSE;

        pCurs->MaxWidth = 64;
        pCurs->MaxHeight = 64;
        pCurs->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
		       HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 |
		       HARDWARE_CURSOR_NIBBLE_SWAPPED |
		       HARDWARE_CURSOR_BIT_ORDER_MSBFIRST;

        pCurs->SetCursorColors = S3TiSetCursorColors;
        pCurs->SetCursorPosition = S3TiSetCursorPosition;
        pCurs->LoadCursorImage = S3TiLoadCursorImage;
        pCurs->HideCursor = S3TiHideCursor;
        pCurs->ShowCursor = S3TiShowCursor;
        pCurs->UseHWCursor = S3TiUseHWCursor;
        
        return xf86InitCursor(pScreen, pCurs);
}
Bool 
FFBHWCursorInit(ScreenPtr pScreen)
{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    FFBPtr pFfb;
    xf86CursorInfoPtr infoPtr;

    pFfb = GET_FFB_FROM_SCRN(pScrn);
    pFfb->CursorShiftX = 0;
    pFfb->CursorShiftY = 0;
    pFfb->CursorData = NULL;

    infoPtr = xf86CreateCursorInfoRec();
    if(!infoPtr) return FALSE;
    
    pFfb->CursorInfoRec = infoPtr;

    infoPtr->MaxWidth = 64;
    infoPtr->MaxHeight = 64;
    infoPtr->Flags =  HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
	HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED;

    infoPtr->SetCursorColors = FFBSetCursorColors;
    infoPtr->SetCursorPosition = FFBSetCursorPosition;
    infoPtr->LoadCursorImage = FFBLoadCursorImage;
    infoPtr->HideCursor = FFBHideCursor;
    infoPtr->ShowCursor = FFBShowCursor;
    infoPtr->UseHWCursor = NULL;

    return xf86InitCursor(pScreen, infoPtr);
}
Example #4
0
Bool 
MGAHWCursorInit(ScreenPtr pScreen)
{
    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    MGAPtr pMga = MGAPTR(pScrn);
    MGARamdacPtr MGAdac = &pMga->Dac;
    xf86CursorInfoPtr infoPtr;

    if (!MGAdac->isHwCursor) 
        return FALSE;

    infoPtr = xf86CreateCursorInfoRec();
    if(!infoPtr) return FALSE;
    
    pMga->CursorInfoRec = infoPtr;

    infoPtr->MaxWidth = MGAdac->CursorMaxWidth;
    infoPtr->MaxHeight = MGAdac->CursorMaxHeight;
    infoPtr->Flags = MGAdac->CursorFlags;
    infoPtr->SetCursorColors = MGAdac->SetCursorColors;
    infoPtr->SetCursorPosition = MGAdac->SetCursorPosition;
    infoPtr->LoadCursorImage = MGAdac->LoadCursorImage;
    infoPtr->HideCursor = MGAdac->HideCursor;
    infoPtr->ShowCursor = MGAdac->ShowCursor;
    infoPtr->UseHWCursor = MGAdac->UseHWCursor;

    return(xf86InitCursor(pScreen, infoPtr));
}
Bool 
TsengHWCursorInit(ScreenPtr pScreen)
{
    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    TsengPtr pTseng = TsengPTR(pScrn);
    xf86CursorInfoPtr infoPtr;

    PDEBUG("	TsengHWCursorInit\n");

    if (!pTseng->HWCursor)
	return FALSE;

    infoPtr = xf86CreateCursorInfoRec();
    if (!infoPtr)
	return FALSE;

    pTseng->CursorInfoRec = infoPtr;

    /* calculate memory addres from video memory offsets */
    pTseng->HWCursorBuffer =
	pTseng->FbBase + pTseng->HWCursorBufferOffset;

    /*
     * for banked memory, translate this address to fall in the
     * correct aperture. HWcursor uses aperture #0, which sits at
     * pTseng->FbBase + 0x18000.
     */
    if (!pTseng->UseLinMem) {
#ifdef TODO
	pTseng->HWCursorBuffer =
	    pTseng->something
	    - pTseng->what
	    + 0x18000;
#else
	ErrorF("banked HW cursor not implemented yet!\n");
#endif
    }

    /* set up the XAA HW cursor structure */
    infoPtr->MaxWidth = 64;
    infoPtr->MaxHeight = 64;
    infoPtr->Flags =
	HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
	HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 |
	HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
	HARDWARE_CURSOR_INVERT_MASK;
    infoPtr->SetCursorColors = TsengSetCursorColors;
    infoPtr->SetCursorPosition = TsengSetCursorPosition;
    infoPtr->LoadCursorImage = TsengLoadCursorImage;
    infoPtr->HideCursor = TsengHideCursor;
    infoPtr->ShowCursor = TsengShowCursor;
    infoPtr->UseHWCursor = TsengUseHWCursor;

    return (xf86InitCursor(pScreen, infoPtr));
}
Example #6
0
void RkDispHardwareCursor_Init(ScreenPtr pScreen)
{
    xf86CursorInfoPtr InfoPtr;
    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    FBDevPtr pMxv = FBDEVPTR(pScrn);
    pMxv->RkHWC = NULL;
    int fd;

    fd = fbdevHWGetFD(pScrn);
    if (fd <= 0){
    	ERRMSG("DispHardwareCursor_Init fd error");
    	return;
    }

    if (!(InfoPtr = xf86CreateCursorInfoRec())) {
    	ERRMSG("DispHardwareCursor_Init: xf86CreateCursorInfoRec() failed");
        return;
    }

    InfoPtr->ShowCursor = ShowCursor;
    InfoPtr->HideCursor = HideCursor;
    InfoPtr->SetCursorPosition = SetCursorPosition;
    InfoPtr->SetCursorColors = SetCursorColors;
    InfoPtr->LoadCursorImage = LoadCursorImage;
    InfoPtr->MaxWidth = 32;
    InfoPtr->MaxHeight = 32;
//    InfoPtr->RealizeCursor
    InfoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1;

    if (!xf86InitCursor(pScreen, InfoPtr)) {
    	ERRMSG("DispHardwareCursor_Init: xf86InitCursor(pScreen, InfoPtr) failed");
        xf86DestroyCursorInfoRec(InfoPtr);
        goto err;
    }

    pMxv->RkHWC = calloc(1, sizeof(RkDispHWCRec));
    if (!pMxv->RkHWC) {
    	ERRMSG("DispHardwareCursor_Init: calloc failed");
        xf86DestroyCursorInfoRec(InfoPtr);
        goto err;
    }
    RkDispHWCPtr HWC = pMxv->RkHWC;

    INFMSG("HWCursor activated");
    HWC->hwcursor = InfoPtr;
    HWC->fb_fd = fd;
    return;
//******************not ok*************
err:
    xf86DestroyCursorInfoRec(InfoPtr);
}
Bool
vmwareCursorInit(ScreenPtr pScreen)
{
    xf86CursorInfoPtr infoPtr;
    VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pScreen));
    Bool ret;

    TRACEPOINT

    /* Require cursor bypass for hwcursor.  Ignore deprecated FIFO hwcursor */
    if (!(pVMWARE->vmwareCapability & SVGA_CAP_CURSOR_BYPASS)) {
        return FALSE;
    }

    infoPtr = xf86CreateCursorInfoRec();
    if (!infoPtr) 
        return FALSE;

    pVMWARE->CursorInfoRec = infoPtr;

    infoPtr->MaxWidth = MAX_CURS;
    infoPtr->MaxHeight = MAX_CURS;
    infoPtr->Flags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
                     HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED;
    infoPtr->SetCursorColors = vmwareSetCursorColors;
    infoPtr->SetCursorPosition = vmwareSetCursorPosition;
    infoPtr->LoadCursorImage = vmwareLoadCursorImage;
    infoPtr->HideCursor = vmwareHideCursor;
    infoPtr->ShowCursor = vmwareShowCursor;
    infoPtr->UseHWCursor = vmwareUseHWCursor;

#ifdef ARGB_CURSOR
    if (pVMWARE->vmwareCapability & SVGA_CAP_ALPHA_CURSOR) {
        infoPtr->UseHWCursorARGB = vmwareUseHWCursorARGB;
        infoPtr->LoadCursorARGB = vmwareLoadCursorARGB;
    }
#endif

    ret = xf86InitCursor(pScreen, infoPtr);
    if (!ret) {
        xf86DestroyCursorInfoRec(infoPtr);
        pVMWARE->CursorInfoRec = NULL;
    }
    return ret;
}
Bool
xf86_cursors_init (ScreenPtr screen, int max_width, int max_height, int flags)
{
    ScrnInfoPtr		scrn = xf86Screens[screen->myNum];
    xf86CrtcConfigPtr   xf86_config = XF86_CRTC_CONFIG_PTR(scrn);
    xf86CursorInfoPtr	cursor_info;

    cursor_info = xf86CreateCursorInfoRec();
    if (!cursor_info)
	return FALSE;

    xf86_config->cursor_image = malloc(max_width * max_height * 4);

    if (!xf86_config->cursor_image)
    {
	xf86DestroyCursorInfoRec (cursor_info);
	return FALSE;
    }
	
    xf86_config->cursor_info = cursor_info;

    cursor_info->MaxWidth = max_width;
    cursor_info->MaxHeight = max_height;
    cursor_info->Flags = flags;

    cursor_info->SetCursorColors = xf86_set_cursor_colors;
    cursor_info->SetCursorPosition = xf86_set_cursor_position;
    cursor_info->LoadCursorImage = xf86_load_cursor_image;
    cursor_info->HideCursor = xf86_hide_cursors;
    cursor_info->ShowCursor = xf86_show_cursors;
    cursor_info->UseHWCursor = xf86_use_hw_cursor;
#ifdef ARGB_CURSOR
    if (flags & HARDWARE_CURSOR_ARGB)
    {
	cursor_info->UseHWCursorARGB = xf86_use_hw_cursor_argb;
	cursor_info->LoadCursorARGB = xf86_load_cursor_argb;
    }
#endif
    
    xf86_config->cursor = NULL;
    xf86_hide_cursors (scrn);
    
    return xf86InitCursor (screen, cursor_info);
}
Example #9
0
Bool
RenditionHWCursorInit(int scrnIndex, ScreenPtr pScreen)
{
    ScrnInfoPtr  pScreenInfo = xf86Screens[scrnIndex];
    renditionPtr pRendition = RENDITIONPTR(pScreenInfo);
    xf86CursorInfoPtr infoPtr;

#ifdef DEBUG
    ErrorF ("Rendition: Debug RenditionHWCursorInit called\n");
#endif

    infoPtr = xf86CreateCursorInfoRec();
    if(!infoPtr) return FALSE;

    pRendition->CursorInfoRec = infoPtr;

#ifdef BIGCURSOR
    infoPtr->MaxWidth=64;
    infoPtr->MaxHeight=64;
#else
    infoPtr->MaxWidth=32;
    infoPtr->MaxHeight=32;
#endif

    infoPtr->Flags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST  |
	HARDWARE_CURSOR_TRUECOLOR_AT_8BPP   | 
	HARDWARE_CURSOR_AND_SOURCE_WITH_MASK|
	HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_8;


    infoPtr->SetCursorColors      = RENDITIONSetCursorColors;
    infoPtr->SetCursorPosition    = RENDITIONSetCursorPosition;
    infoPtr->LoadCursorImage      = RENDITIONLoadCursorImage;
    infoPtr->HideCursor           = RENDITIONHideCursor;
    infoPtr->ShowCursor           = RENDITIONShowCursor;
    infoPtr->UseHWCursor          = RENDITIONUseHWCursor;

    return xf86InitCursor(pScreen, infoPtr);
}
Example #10
0
Bool
I830CursorInit(ScreenPtr pScreen)
{
   ScrnInfoPtr pScrn;
   I830Ptr pI830;
   xf86CursorInfoPtr infoPtr;

   DPRINTF(PFX, "I830CursorInit\n");
   pScrn = xf86Screens[pScreen->myNum];
   pI830 = I830PTR(pScrn);
   pI830->CursorInfoRec = infoPtr = xf86CreateCursorInfoRec();
   if (!infoPtr)
      return FALSE;

   infoPtr->MaxWidth = 64;
   infoPtr->MaxHeight = 64;
   infoPtr->Flags = (HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
		     HARDWARE_CURSOR_BIT_ORDER_MSBFIRST |
		     HARDWARE_CURSOR_INVERT_MASK |
		     HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK |
		     HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
		     HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 | 0);

   infoPtr->SetCursorColors = I830SetCursorColors;
   infoPtr->SetCursorPosition = I830SetCursorPosition;
   infoPtr->LoadCursorImage = I830LoadCursorImage;
   infoPtr->HideCursor = I830HideCursor;
   infoPtr->ShowCursor = I830ShowCursor;
   infoPtr->UseHWCursor = I830UseHWCursor;

   if (pI830->CursorNeedsPhysical && !pI830->CursorMem.Physical)
      return FALSE;

   I830HideCursor(pScrn);

   return xf86InitCursor(pScreen, infoPtr);
}
Example #11
0
Bool
viaHWCursorInit(ScreenPtr pScreen)
{
    ScrnInfoPtr pScrn = xf86ScreenToScrn(pScreen);
    VIAPtr pVia = VIAPTR(pScrn);
    xf86CursorInfoPtr infoPtr;

	switch (pVia->Chipset) {
		case VIA_CLE266:
		case VIA_KM400:
			/* FIXME Mono HW Cursors not working */
			pVia->hwcursor = FALSE;
			pVia->CursorARGBSupported = FALSE;
			pVia->CursorMaxWidth = 32;
			pVia->CursorMaxHeight = 32;
			pVia->CursorSize = ((pVia->CursorMaxWidth * pVia->CursorMaxHeight) / 8) * 2;
			break;
		default:
			pVia->CursorARGBSupported = TRUE;
			pVia->CursorMaxWidth = 64;
			pVia->CursorMaxHeight = 64;
			pVia->CursorSize = pVia->CursorMaxWidth * (pVia->CursorMaxHeight + 1) << 2;
			break;
    }

    if (pVia->NoAccel) 
    	viaCursorSetFB(pScrn);

    pVia->cursorMap = pVia->FBBase + pVia->CursorStart;

    if (pVia->cursorMap == NULL)
		return FALSE;

    pVia->cursorOffset = pScrn->fbOffset + pVia->CursorStart;
    memset(pVia->cursorMap, 0x00, pVia->CursorSize);

    switch (pVia->Chipset) {
        case VIA_CX700:
        /* case VIA_CN750: */
        case VIA_P4M890:
        case VIA_P4M900:
        case VIA_VX800:
        case VIA_VX855:
        case VIA_VX900:
			if (pVia->pBIOSInfo->FirstCRTC->IsActive) {
				pVia->CursorRegControl  = VIA_REG_HI_CONTROL0;
				pVia->CursorRegBase     = VIA_REG_HI_BASE0;
				pVia->CursorRegPos      = VIA_REG_HI_POS0;
				pVia->CursorRegOffset   = VIA_REG_HI_OFFSET0;
				pVia->CursorRegFifo     = VIA_REG_HI_FIFO0;
				pVia->CursorRegTransKey = VIA_REG_HI_TRANSKEY0;
			}
			if (pVia->pBIOSInfo->SecondCRTC->IsActive) {
				pVia->CursorRegControl  = VIA_REG_HI_CONTROL1;
				pVia->CursorRegBase     = VIA_REG_HI_BASE1;
				pVia->CursorRegPos      = VIA_REG_HI_POS1;
				pVia->CursorRegOffset   = VIA_REG_HI_OFFSET1;
				pVia->CursorRegFifo     = VIA_REG_HI_FIFO1;
				pVia->CursorRegTransKey = VIA_REG_HI_TRANSKEY1;
			}
			break;
		default:
			pVia->CursorRegControl = VIA_REG_ALPHA_CONTROL;
			pVia->CursorRegBase = VIA_REG_ALPHA_BASE;
			pVia->CursorRegPos = VIA_REG_ALPHA_POS;
			pVia->CursorRegOffset = VIA_REG_ALPHA_OFFSET;
			pVia->CursorRegFifo = VIA_REG_ALPHA_FIFO;
			pVia->CursorRegTransKey = VIA_REG_ALPHA_TRANSKEY;
    }

    DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "VIAHWCursorInit\n"));
    infoPtr = xf86CreateCursorInfoRec();
    if (!infoPtr)
        return FALSE;

    pVia->CursorInfoRec = infoPtr;

    infoPtr->MaxWidth = pVia->CursorMaxWidth;
    infoPtr->MaxHeight = pVia->CursorMaxHeight;
    infoPtr->Flags = (HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 |
                      HARDWARE_CURSOR_AND_SOURCE_WITH_MASK |
                      HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
                      0);

    infoPtr->SetCursorColors = viaSetCursorColors;
    infoPtr->SetCursorPosition = viaSetCursorPosition;
    infoPtr->LoadCursorImage = viaLoadCursorImage;
    infoPtr->HideCursor = viaHideCursor;
    infoPtr->ShowCursor = viaShowCursor;
    infoPtr->UseHWCursor = viaUseHWCursor;

    /* ARGB Cursor init */
    infoPtr->UseHWCursorARGB = viaUseHWCursorARGB;
    if (pVia->CursorARGBSupported) {
        DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "HWCursor ARGB enabled\n"));
    	infoPtr->LoadCursorARGB = viaLoadCursorARGB;
    }

    /* Set cursor location in frame buffer. */
    VIASETREG(VIA_REG_CURSOR_MODE, pVia->cursorOffset);

    pVia->CursorPipe = (pVia->pBIOSInfo->Panel->IsActive) ? 1 : 0;

    /* Init HI_X0 */
    VIASETREG(pVia->CursorRegControl, 0);
    VIASETREG(pVia->CursorRegBase, pVia->cursorOffset);
    VIASETREG(pVia->CursorRegTransKey, 0);

    switch (pVia->Chipset) {
        case VIA_CX700:
        /* case VIA_CN750: */
        case VIA_P4M890:
        case VIA_P4M900:
        case VIA_VX800:
        case VIA_VX855:
        case VIA_VX900:
			if (pVia->pBIOSInfo->FirstCRTC->IsActive) {
				VIASETREG(VIA_REG_PRIM_HI_INVTCOLOR, 0x00FFFFFF);
				VIASETREG(VIA_REG_V327_HI_INVTCOLOR, 0x00FFFFFF);
				VIASETREG(pVia->CursorRegFifo, 0x0D000D0F);
			}
			if (pVia->pBIOSInfo->SecondCRTC->IsActive) {
				VIASETREG(VIA_REG_HI_INVTCOLOR, 0X00FFFFFF);
				VIASETREG(VIA_REG_ALPHA_PREFIFO, 0xE0000);
				VIASETREG(pVia->CursorRegFifo, 0xE0F0000);

				/* Just in case */
				VIASETREG(VIA_REG_HI_BASE0, pVia->cursorOffset);
			}
			break;
    	default:
			VIASETREG(VIA_REG_HI_INVTCOLOR, 0X00FFFFFF);
			VIASETREG(VIA_REG_ALPHA_PREFIFO, 0xE0000);
			VIASETREG(pVia->CursorRegFifo, 0xE0F0000);
	}

    return xf86InitCursor(pScreen, infoPtr);
}
Example #12
0
/* Initialize hardware cursor support. */
Bool R128CursorInit(ScreenPtr pScreen)
{
    ScrnInfoPtr           pScrn   = xf86Screens[pScreen->myNum];
    R128InfoPtr           info    = R128PTR(pScrn);
    xf86CursorInfoPtr     cursor;
    FBAreaPtr             fbarea;
    int                   width;
    int                   height;
    int                   size;


    if (!(cursor = info->cursor = xf86CreateCursorInfoRec())) return FALSE;

    cursor->MaxWidth          = 64;
    cursor->MaxHeight         = 64;
    cursor->Flags             = (HARDWARE_CURSOR_TRUECOLOR_AT_8BPP
				 | HARDWARE_CURSOR_SHOW_TRANSPARENT
				 | HARDWARE_CURSOR_UPDATE_UNHIDDEN
#if X_BYTE_ORDER == X_LITTLE_ENDIAN
				 | HARDWARE_CURSOR_BIT_ORDER_MSBFIRST
#endif
				 | HARDWARE_CURSOR_INVERT_MASK
				 | HARDWARE_CURSOR_AND_SOURCE_WITH_MASK
				 | HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64
				 | HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK);

    cursor->SetCursorColors   = R128SetCursorColors;
    cursor->SetCursorPosition = R128SetCursorPosition;
    cursor->LoadCursorImage   = R128LoadCursorImage;
    cursor->HideCursor        = R128HideCursor;
    cursor->ShowCursor        = R128ShowCursor;
    cursor->UseHWCursor       = R128UseHWCursor;

    size                      = (cursor->MaxWidth/4) * cursor->MaxHeight;
    width                     = pScrn->displayWidth;
    height                    = (size*2 + 1023) / pScrn->displayWidth;
    fbarea                    = xf86AllocateOffscreenArea(pScreen,
							  width,
							  height,
							  16,
							  NULL,
							  NULL,
							  NULL);

    if (!fbarea) {
	info->cursor_start    = 0;
	xf86DrvMsg(pScrn->scrnIndex, X_WARNING,
		   "Hardware cursor disabled"
		   " due to insufficient offscreen memory\n");
    } else {
	info->cursor_start    = R128_ALIGN((fbarea->box.x1
					    + width * fbarea->box.y1)
					   * info->CurrentLayout.pixel_bytes, 16);
	info->cursor_end      = info->cursor_start + size;
    }

    R128TRACE(("R128CursorInit (0x%08x-0x%08x)\n",
	       info->cursor_start, info->cursor_end));

    return xf86InitCursor(pScreen, cursor);
}
Example #13
0
void Rk30DispHardwareCursor_Init(ScreenPtr pScreen, const char *device)
{
    xf86CursorInfoPtr InfoPtr;
    ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
    FBDevPtr pMxv = FBDEVPTR(pScrn);

    pMxv->Rk30HWC = NULL;

    if(NULL == pMxv->OvlHW){
    xf86DrvMsg( pScreen->myNum, X_ERROR, "DispHardwareCursor_Init: Not found overlay\n");
    return;
    }

    OvlHWPtr    overlay = pMxv->OvlHW;

    if (!(InfoPtr = xf86CreateCursorInfoRec())) {
        xf86DrvMsg( pScreen->myNum, X_ERROR, "DispHardwareCursor_Init: xf86CreateCursorInfoRec() failed\n");
        return;
    }

    InfoPtr->ShowCursor = ShowCursor;
    InfoPtr->HideCursor = HideCursor;
    InfoPtr->SetCursorPosition = SetCursorPosition;
    InfoPtr->SetCursorColors = SetCursorColors;
    InfoPtr->LoadCursorImage = LoadCursorImage;
    InfoPtr->MaxWidth = InfoPtr->MaxHeight = 32;
    InfoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP |
                     HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1 |
                     HARDWARE_CURSOR_ARGB;

    if (!xf86InitCursor(pScreen, InfoPtr)) {
    xf86DrvMsg(pScreen->myNum, X_ERROR, "DispHardwareCursor_Init: xf86InitCursor(pScreen, InfoPtr) failed\n");
        xf86DestroyCursorInfoRec(InfoPtr);
        goto err;
    }

    pMxv->Rk30HWC = calloc(1, sizeof(Rk30DispHWCRec));
    if (!pMxv->Rk30HWC) {
        xf86DrvMsg( pScreen->myNum, X_ERROR, "DispHardwareCursor_Init: calloc failed\n");
        xf86DestroyCursorInfoRec(InfoPtr);
        goto err;
    }
    Rk30DispHWCPtr HWC = pMxv->Rk30HWC;

    HWC->fb_fd = open(device, O_RDWR);
    if (HWC->fb_fd < 0) {
        xf86DrvMsg( pScreen->myNum, X_ERROR, "DispHardwareCursor_Init: open: %s failed\n",device);
//    close(HWC->fb_fd);
        free(HWC);
        goto err;
    }
//    private->cursor_enabled = 0;
//    private->cursor_x = -1;
//    private->cursor_y = -1;

    xf86DrvMsg(pScreen->myNum, X_INFO, "Enabled hardware cursor\n");
    HWC->hwcursor = InfoPtr;
    return;
//******************not ok*************
err:
    xf86DestroyCursorInfoRec(InfoPtr);
}