static void
FFBSetCursorPosition(ScrnInfoPtr pScrn, int x, int y)
{
    FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn);
    int CursorShiftX = 0, CursorShiftY = 0;

    if (x < 0) {
	CursorShiftX = -x;
	x = 0;
	if (CursorShiftX > 64)
	    CursorShiftX = 64;
    }
    if (y < 0) {
	CursorShiftY = -y;
	y = 0;
	if (CursorShiftY > 64)
	    CursorShiftY = 64;
    }
    if ((CursorShiftX != pFfb->CursorShiftX ||
	 CursorShiftY != pFfb->CursorShiftY) &&
	pFfb->CursorData != NULL) {
	pFfb->CursorShiftX = CursorShiftX;
	pFfb->CursorShiftY = CursorShiftY;
	FFBLoadCursorImage(pScrn, pFfb->CursorData);
    }
	
    FFBDacLoadCursorPos(pFfb, x, y);
}
static void 
FFBShowCursor(ScrnInfoPtr pScrn)
{
    FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn);

    FFBDacCursorEnableDisable(pFfb, 1);
}
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);
}
예제 #4
0
static void FFB_Flush(ScrnInfoPtr pScrn)
{
	FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn);
	ffb_fbcPtr ffb = pFfb->regs;

	FFBWait(pFfb, ffb);
}
static void
FFBSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg)
{
    FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn);

    FFBDacLoadCursorColor(pFfb, fg, bg);
}
예제 #6
0
static void
FFBI2CPutBits(I2CBusPtr b, int clock, int data)
{
	FFBPtr pFfb = GET_FFB_FROM_SCRN(xf86Screens[b->scrnIndex]);
	ffb_dacPtr dac = pFfb->dac;
	unsigned int val;
#ifdef MDATA_NEEDS_BLANK
	unsigned int uctrl;
#endif

	val = 0;
	if (clock)
		val |= FFBDAC_CFG_MPDATA_SCL;
	if (data)
		val |= FFBDAC_CFG_MPDATA_SDA;

#ifdef MDATA_NEEDS_BLANK
	/* Force a blank of the screen. */
	uctrl = DACCFG_READ(dac, FFBDAC_CFG_UCTRL);
	DACCFG_WRITE(dac, FFBDAC_CFG_UCTRL,
			  (uctrl | FFBDAC_UCTRL_ABLANK));
#endif

	/* Tristate requested pins. */
	DACCFG_WRITE(dac, FFBDAC_CFG_MPDATA, val);

#ifdef MDATA_NEEDS_BLANK
	/* Restore UCTRL to unblank the screen. */
	DACCFG_WRITE(dac, FFBDAC_CFG_UCTRL, uctrl);
#endif
}
static void
FFBHideCursor(ScrnInfoPtr pScrn)
{
    FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn);

    FFBDacCursorEnableDisable(pFfb, 0);
    pFfb->CursorData = NULL;
}
예제 #8
0
static void FFB_BlitRect(ScrnInfoPtr pScrn, int srcx, int srcy,
			 int w, int h, int dstx, int dsty)
{
	FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn);
	ffb_fbcPtr ffb = pFfb->regs;

	if (!pFfb->disable_vscroll &&
	    dstx == srcx &&
	    dsty != dsty) {
		FFB_WRITE_ATTRIBUTES_VSCROLL(pFfb, 0x00ffffff);
		FFBFifo(pFfb, 7);
		ffb->drawop = FFB_DRAWOP_VSCROLL;
		FFB_WRITE64(&ffb->by, srcy, srcx);
		FFB_WRITE64_2(&ffb->dy, dsty, dstx);
		FFB_WRITE64_3(&ffb->bh, h, w);
		pFfb->rp_active = 1;
	} else {
		unsigned char *base = (unsigned char *)pFfb->fb;
		int use_prefetch = pFfb->use_blkread_prefetch;

		FFB_WRITE_ATTRIBUTES_SFB_VAR(pFfb, 0x00ffffff, GXcopy);
		FFBWait(pFfb, ffb);
		if (use_prefetch) {
			FFBFifo(pFfb, 1);
			ffb->mer = FFB_MER_EIRA;
			pFfb->rp_active = 1;
			FFBWait(pFfb, ffb);
		}
		if (srcx < dstx) {
			VISmoveImageRL((base +
					((srcy + h - 1) * (2048 * 4)) +
					(srcx * (32 / 8))),
				       (base +
					((dsty + h - 1) * (2048 * 4)) +
					(dstx * (32 / 8))),
				       (w * (32 / 8)),
				       h,
				       -(2048 * 4), - (2048 * 4));
		} else {
			VISmoveImageLR((base +
					((srcy + h - 1) * (2048 * 4)) +
					(srcx * (32 / 8))),
				       (base +
					((dsty + h - 1) * (2048 * 4)) +
					(dstx * (32 / 8))),
				       (w * (32 / 8)),
				       h,
				       -(2048 * 4), - (2048 * 4));
		}
		if (use_prefetch) {
			FFBFifo(pFfb, 1);
			ffb->mer = FFB_MER_DRA;
			pFfb->rp_active = 1;
			FFBWait(pFfb, pFfb->regs);
		}
	}
}
static void
FFBLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src)
{
    FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn);
    unsigned int *data = (unsigned int *)src;
    int x, y;

    pFfb->CursorData = src;
    x = pFfb->CursorShiftX;
    y = pFfb->CursorShiftY;
    if (x >= 64 || y >= 64)
	y = 64;
    FFBDacCursorLoadBitmap(pFfb, x, y, data);
}
예제 #10
0
static Bool FFB_OpenFramebuffer(ScrnInfoPtr pScrn, char **name, unsigned char **mem,
				int *size, int *offset, int *extra)
{
	FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn);

	*name = pFfb->psdp->device;

	/* We give the user the dumb frame buffer. */
	*mem = (unsigned char *)FFB_DFB24_VOFF;
	*size = 0x1000000;
	*offset = 0;
	*extra = 0;

	return TRUE;
}
예제 #11
0
/* DDC1/DDC2 support */
static unsigned int
FFBDacDdc1Read(ScrnInfoPtr pScrn)
{
	FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn);
	ffb_dacPtr dac = pFfb->dac;
	unsigned int val;
#ifdef MDATA_NEEDS_BLANK
	unsigned int uctrl;
#endif

#ifdef MDATA_NEEDS_BLANK
	/* Force a blank of the screen. */
	uctrl = DACCFG_READ(dac, FFBDAC_CFG_UCTRL);
	DACCFG_WRITE(dac, FFBDAC_CFG_UCTRL,
			  (uctrl | FFBDAC_UCTRL_ABLANK));
#endif

	/* Tristate SCL pin. */
	DACCFG_WRITE(dac, FFBDAC_CFG_MPDATA,
			  FFBDAC_CFG_MPDATA_SCL);

	/* Pause until VSYNC is hit. */
	WaitForVSYNC(dac);

	/* Read the sense line to see what the monitor is driving
	 * it at.
	 */
	val = DACCFG_READ(dac, FFBDAC_CFG_MPSENSE);
	val = (val & FFBDAC_CFG_MPSENSE_SCL) ? 1 : 0;

	/* Stop tristating the SCL pin. */
	DACCFG_WRITE(dac, FFBDAC_CFG_MPDATA, 0);

#ifdef MDATA_NEEDS_BLANK
	/* Restore UCTRL to unblank the screen. */
	DACCFG_WRITE(dac, FFBDAC_CFG_UCTRL, uctrl);
#endif

	/* Return the result and we're done. */
	return val;
}
예제 #12
0
Bool
FFBi2cInit(ScrnInfoPtr pScrn)
{
	FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn);
	I2CBusPtr I2CPtr;

	I2CPtr = xf86CreateI2CBusRec();
	if (!I2CPtr)
		return FALSE;

	pFfb->I2C = I2CPtr;

	I2CPtr->BusName		= "DDC";
	I2CPtr->scrnIndex	= pScrn->scrnIndex;
	I2CPtr->I2CPutBits	= FFBI2CPutBits;
	I2CPtr->I2CGetBits	= FFBI2CGetBits;
	I2CPtr->AcknTimeout	= 5;

	if (!xf86I2CBusInit(I2CPtr))
		return FALSE;

	return TRUE;
}
예제 #13
0
static void
FFBI2CGetBits(I2CBusPtr b, int *clock, int *data)
{
	FFBPtr pFfb = GET_FFB_FROM_SCRN(xf86Screens[b->scrnIndex]);
	ffb_dacPtr dac = pFfb->dac;
	unsigned int val;
#ifdef MDATA_NEEDS_BLANK
	unsigned int uctrl;
#endif

#ifdef MDATA_NEEDS_BLANK
	/* Force a blank of the screen. */
	uctrl = DACCFG_READ(dac, FFBDAC_CFG_UCTRL);
	DACCFG_WRITE(dac, FFBDAC_CFG_UCTRL,
			  (uctrl | FFBDAC_UCTRL_ABLANK));
#endif

	/* Tristate SCL+SDA pins. */
	DACCFG_WRITE(dac, FFBDAC_CFG_MPDATA,
		     (FFBDAC_CFG_MPDATA_SCL | FFBDAC_CFG_MPDATA_SDA));

	/* Read the sense line to see what the monitor is driving
	 * them at.
	 */
	val = DACCFG_READ(dac, FFBDAC_CFG_MPSENSE);
	*clock = (val & FFBDAC_CFG_MPSENSE_SCL) ? 1 : 0;
	*data  = (val & FFBDAC_CFG_MPSENSE_SDA) ? 1 : 0;

	/* Stop tristating the SCL pin. */
	DACCFG_WRITE(dac, FFBDAC_CFG_MPDATA, 0);

#ifdef MDATA_NEEDS_BLANK
	/* Restore UCTRL to unblank the screen. */
	DACCFG_WRITE(dac, FFBDAC_CFG_UCTRL, uctrl);
#endif
}
예제 #14
0
void FFB_InitDGA(ScreenPtr pScreen)
{
	ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
	FFBPtr pFfb;
	DGAModePtr mode;
	Bool result;

	pFfb = GET_FFB_FROM_SCRN(pScrn);

	mode = xnfcalloc(sizeof(DGAModeRec), 1);
	if (!mode) {
		xf86Msg(X_WARNING, "%s: DGA init failed, cannot alloc DGAMode.\n",
			pFfb->psdp->device);
		return;
	}

	mode->num = 0;
	mode->mode = pScrn->modes;

	/* Hmmm, what does concurrent access really mean? -DaveM */
	mode->flags = (DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE | DGA_FILL_RECT);

#ifdef USE_VIS
	mode->flags |= DGA_BLIT_RECT;
#endif

	mode->imageWidth = 2048;
	mode->imageHeight = 2048;
	mode->pixmapWidth = 2048;
	mode->pixmapHeight = 2048;

	/* XXX I would imagine that this value states how many bytes
	 * XXX you add to advance exactly one full horizontal line in
	 * XXX the framebuffer addressing, but the way we set the pScrn
	 * XXX mode values do not match that definition.
	 * XXX
	 * XXX Ask Jakub what is going on here. -DaveM
	 */
#if 1
	mode->bytesPerScanline = pScrn->modes->HDisplay * 4;
#else
	mode->bytesPerScanline = (2048 * 4);
#endif

	mode->byteOrder = pScrn->imageByteOrder;
	mode->depth = 32;
	mode->bitsPerPixel = 32;
	mode->red_mask = 0xff;
	mode->green_mask = 0xff00;
	mode->blue_mask = 0xff0000;
	mode->visualClass = TrueColor;
	mode->viewportWidth = pScrn->modes->HDisplay;
	mode->viewportHeight = pScrn->modes->VDisplay;

	/* Do these values even matter if we do not support
	 * viewports? -DaveM
	 */
	mode->xViewportStep = 0;
	mode->yViewportStep = 0;
	mode->maxViewportX = 0;
	mode->maxViewportY = 0;

	mode->viewportFlags = 0;
	mode->offset = 0;

	result = DGAInit(pScreen, &FFB_DGAFuncs, mode, 1);
	if (result == FALSE) {
		xf86Msg(X_WARNING,
			"%s: DGA init failed, DGAInit returns FALSE.\n",
			pFfb->psdp->device);
	} else {
		xf86Msg(X_INFO, "%s: DGA support initialized.\n",
			pFfb->psdp->device);
	}
}