Пример #1
0
Bool
GLAMOExaPrepareCopy(PixmapPtr       pSrc,
		    PixmapPtr       pDst,
		    int             dx,
		    int             dy,
		    int             alu,
		    Pixel           pm)
{
	ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum];
	GlamoPtr pGlamo = GlamoPTR(pScrn);

    RING_LOCALS;

    FbBits mask;

    CARD32 src_offset, dst_offset;
    CARD16 src_pitch, dst_pitch;
    CARD16 op;

	if (pSrc->drawable.bitsPerPixel != 16 ||
	    pDst->drawable.bitsPerPixel != 16)
		GLAMO_FALLBACK(("Only 16bpp is supported"));

	mask = FbFullMask(16);
	if ((pm & mask) != mask) {
		GLAMO_FALLBACK(("Can't do planemask 0x%08x",
				(unsigned int) pm));
	}

	src_offset = exaGetPixmapOffset(pSrc);
	src_pitch = pSrc->devKind;

	dst_offset = exaGetPixmapOffset(pDst);
	dst_pitch = pDst->devKind;

	op = GLAMOBltRop[alu] << 8;

    BEGIN_CMDQ(20);
    OUT_REG(GLAMO_REG_2D_SRC_ADDRL, src_offset & 0xffff);
	OUT_REG(GLAMO_REG_2D_SRC_ADDRH, (src_offset >> 16) & 0x7f);
	OUT_REG(GLAMO_REG_2D_SRC_PITCH, src_pitch & 0x7ff);

	OUT_REG(GLAMO_REG_2D_DST_ADDRL, dst_offset & 0xffff);
	OUT_REG(GLAMO_REG_2D_DST_ADDRH, (dst_offset >> 16) & 0x7f);
	OUT_REG(GLAMO_REG_2D_DST_PITCH, dst_pitch & 0x7ff);
	OUT_REG(GLAMO_REG_2D_DST_HEIGHT, pDst->drawable.height);

	OUT_REG(GLAMO_REG_2D_COMMAND2, op);
	OUT_REG(GLAMO_REG_2D_ID1, 0);
	OUT_REG(GLAMO_REG_2D_ID2, 0);
	END_CMDQ();


	return TRUE;
}
Пример #2
0
/**
 * Does fake acceleration of UploadToScreen using memcpy.
 */
static Bool
ephyrUploadToScreen(PixmapPtr pDst, int x, int y, int w, int h, char *src,
		    int src_pitch)
{
    KdScreenPriv(pDst->drawable.pScreen);
    KdScreenInfo *screen = pScreenPriv->screen;
    EphyrScrPriv *scrpriv = screen->driver;
    EphyrFakexaPriv *fakexa = scrpriv->fakexa;
    unsigned char *dst;
    int dst_pitch, cpp;

    if (pDst->drawable.bitsPerPixel < 8)
	return FALSE;

    ephyrPreparePipelinedAccess(pDst, EXA_PREPARE_DEST);

    cpp = pDst->drawable.bitsPerPixel / 8;
    dst_pitch = exaGetPixmapPitch(pDst);
    dst = fakexa->exa->memoryBase + exaGetPixmapOffset(pDst);
    dst += y * dst_pitch + x * cpp;

    for (; h > 0; h--) {
	memcpy(dst, src, w * cpp);
	dst += dst_pitch;
	src += src_pitch;
    }

    exaMarkSync(pDst->drawable.pScreen);

    ephyrFinishPipelinedAccess(pDst, EXA_PREPARE_DEST);

    return TRUE;
}
static Bool
setDst(G80Ptr pNv, PixmapPtr pDst)
{
    CARD32 depth, depth2;

    switch(pDst->drawable.depth) {
        case  8: depth = 0x000000f3; depth2 = 3; break;
        case 15: depth = 0x000000f8; depth2 = 1; break;
        case 16: depth = 0x000000e8; depth2 = 0; break;
        case 24: depth = 0x000000e6; depth2 = 2; break;
        case 32: depth = 0x000000cf; depth2 = 2; break;
        default: return FALSE;
    }

    G80DmaStart(pNv, 0x200, 2);
    G80DmaNext (pNv, depth);
    G80DmaNext (pNv, 0x00000001);
    G80DmaStart(pNv, 0x214, 5);
    G80DmaNext (pNv, exaGetPixmapPitch(pDst));
    G80DmaNext (pNv, pDst->drawable.width);
    G80DmaNext (pNv, pDst->drawable.height);
    G80DmaNext (pNv, 0x00000000);
    G80DmaNext (pNv, exaGetPixmapOffset(pDst));
    G80DmaStart(pNv, 0x2e8, 1);
    G80DmaNext (pNv, depth2);
    G80DmaStart(pNv, 0x584, 1);
    G80DmaNext (pNv, depth);
    G80SetClip(pNv, 0, 0, pDst->drawable.width, pDst->drawable.height);

    return TRUE;
}
static Bool
setSrc(G80Ptr pNv, PixmapPtr pSrc)
{
    CARD32 depth;

    switch(pSrc->drawable.depth) {
        case  8: depth = 0x000000f3; break;
        case 15: depth = 0x000000f8; break;
        case 16: depth = 0x000000e8; break;
        case 24: depth = 0x000000e6; break;
        case 32: depth = 0x000000cf; break;
        default: return FALSE;
    }

    G80DmaStart(pNv, 0x230, 2);
    G80DmaNext (pNv, depth);
    G80DmaNext (pNv, 0x00000001);
    G80DmaStart(pNv, 0x244, 5);
    G80DmaNext (pNv, exaGetPixmapPitch(pSrc));
    G80DmaNext (pNv, pSrc->drawable.width);
    G80DmaNext (pNv, pSrc->drawable.height);
    G80DmaNext (pNv, 0x00000000);
    G80DmaNext (pNv, exaGetPixmapOffset(pSrc));

    return TRUE;
}
Пример #5
0
Bool
GLAMOExaDownloadFromScreen(PixmapPtr pSrc,
			   int x,  int y,
			   int w,  int h,
			   char *dst,
			   int dst_pitch)
{
	ScrnInfoPtr pScrn = xf86Screens[pSrc->drawable.pScreen->myNum];
	GlamoPtr pGlamo = GlamoPTR(pScrn);

	int bpp, i;
	CARD8 *dst_offset, *src;
	int src_pitch;

	bpp = pSrc->drawable.bitsPerPixel;
	bpp /= 8;
	src_pitch = pSrc->devKind;
	src = pGlamo->exa->memoryBase + exaGetPixmapOffset(pSrc) +
						x*bpp + y*src_pitch;
	dst_offset = (unsigned char*)dst;

	for (i = 0; i < h; i++) {
		memcpy(dst_offset, src, w*bpp);
		dst_offset += dst_pitch;
		src += src_pitch;
	}

	return TRUE;
}
Пример #6
0
Bool
GLAMOExaUploadToScreen(PixmapPtr pDst,
		       int x,
		       int y,
		       int w,
		       int h,
		       char *src,
		       int src_pitch)
{
	ScrnInfoPtr pScrn = xf86Screens[pDst->drawable.pScreen->myNum];
	GlamoPtr pGlamo = GlamoPTR(pScrn);

	int bpp, i;
	CARD8 *dst_offset;
	int dst_pitch;

	bpp = pDst->drawable.bitsPerPixel / 8;
	dst_pitch = pDst->devKind;
	dst_offset = pGlamo->exa->memoryBase + exaGetPixmapOffset(pDst)
						+ x*bpp + y*dst_pitch;

	for (i = 0; i < h; i++) {
		memcpy(dst_offset, src, w*bpp);
		dst_offset += dst_pitch;
		src += src_pitch;
	}

	return TRUE;
}
Пример #7
0
/**
 * Forces a real devPrivate.ptr for hidden pixmaps, so that we can call down to
 * fb functions.
 */
static void
ephyrPreparePipelinedAccess(PixmapPtr pPix, int index)
{
    KdScreenPriv(pPix->drawable.pScreen);
    KdScreenInfo *screen = pScreenPriv->screen;
    EphyrScrPriv *scrpriv = screen->driver;
    EphyrFakexaPriv *fakexa = scrpriv->fakexa;

    assert(fakexa->saved_ptrs[index] == NULL);
    fakexa->saved_ptrs[index] = pPix->devPrivate.ptr;

    if (pPix->devPrivate.ptr != NULL)
	return;

    pPix->devPrivate.ptr = fakexa->exa->memoryBase + exaGetPixmapOffset(pPix);
}
Пример #8
0
Bool
GLAMOExaPrepareSolid(PixmapPtr      pPix,
		     int            alu,
		     Pixel          pm,
		     Pixel          fg)
{
	ScrnInfoPtr pScrn = xf86Screens[pPix->drawable.pScreen->myNum];
	GlamoPtr pGlamo = GlamoPTR(pScrn);

	CARD32 offset;
    CARD16 op, pitch;
	FbBits mask;
	RING_LOCALS;

	if (pPix->drawable.bitsPerPixel != 16)
		GLAMO_FALLBACK(("Only 16bpp is supported\n"));

	mask = FbFullMask(16);
	if ((pm & mask) != mask)
		GLAMO_FALLBACK(("Can't do planemask 0x%08x\n",
				(unsigned int) pm));

	op = GLAMOSolidRop[alu] << 8;
	offset = exaGetPixmapOffset(pPix);
	pitch = pPix->devKind;

	BEGIN_CMDQ(16);
	OUT_REG(GLAMO_REG_2D_DST_ADDRL, offset & 0xffff);
	OUT_REG(GLAMO_REG_2D_DST_ADDRH, (offset >> 16) & 0x7f);
	OUT_REG(GLAMO_REG_2D_DST_PITCH, pitch & 0x7ff);
	OUT_REG(GLAMO_REG_2D_DST_HEIGHT, pPix->drawable.height);
	OUT_REG(GLAMO_REG_2D_PAT_FG, fg);
	OUT_REG(GLAMO_REG_2D_COMMAND2, op);
	OUT_REG(GLAMO_REG_2D_ID1, 0);
	OUT_REG(GLAMO_REG_2D_ID2, 0);
	END_CMDQ();

	return TRUE;
}